/*
 * Copyright © 2021-2023 Innospots (http://www.innospots.com)
 *  Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  See the NOTICE file distributed with
 *  this work for additional information regarding copyright ownership.
 *  The ASF licenses this file to You under the Apache License, Version 2.0
 *  (the "License"); you may not use this file except in compliance with
 *  the License. You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

@import '~antd/es/style/themes/index.less';
@import '../../../assets/less/variables.less';

@pagination-item-size: 32px;
@pagination-prefix-cls: ~'@{ant-prefix}-pagination';

.cardListWrapper {
  .nameWrapper {
    .icon {
      width: 48px;
      height: 48px;
      border: 1px solid #ccc;
      border-radius: 100%;
    }

    .name {
      margin-bottom: 0;
      padding-left: 16px;
    }
  }

  .tag {
    position: absolute;
    top: 20px;
    right: 20px;
  }

  :global {
    .@{ant-prefix}-tag {
      min-width: 48px;
      margin-right: 0;
      line-height: @height-sm;
      text-align: center;
      border: 0;
    }

    .@{ant-prefix}-tag-green {
      color: #31cb8a;
      background: #dbf4ec;
    }

    .@{ant-prefix}-tag-blue {
      color: @primary-color;
      background: #ecf0ff;
    }

    .@{ant-prefix}-tag-magenta {
      color: #f4427d;
      background: #ffe5ef;
    }
  }

  .avatar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e5ecff;

    img {
      position: absolute;
      width: auto;
      max-width: 60%;
      height: auto;
      max-height: 60%;
    }

    &.sd {
      &:after {
        position: absolute;
        bottom: 0;
        left: 0;
        display: block;
        width: 14px;
        height: 14px;
        background-image: url('../../../assets/images/data-source/u18063.png');
        background-size: 100% auto;
        content: ' ';
      }
    }
  }

  .infoWrapper {
    margin: 16px 0 -14px;
    color: #4e5969;

    :global {
      p,
      .@{ant-prefix}-typography {
        margin-bottom: 0;
        color: #4e5969;
        font-weight: 400;
      }
    }
  }

  :global {
    .@{ant-prefix}-avatar {
      overflow: initial;
    }

    .@{ant-prefix}-pro-components-nice-nice-list-style-niceList
      .@{ant-prefix}-table
      .@{ant-prefix}-table-tbody
      > tr
      > td {
      height: 68px;
    }

    .@{ant-prefix}-card {
      position: relative;
      height: 100%;
      overflow: hidden;
      border-radius: 10px;
      //box-shadow: 0 0 8px 0 #00000019;
      transition: box-shadow 0.3s;

      &:hover {
        box-shadow: 1px 1px 8px rgba(0, 0, 0, 10%);
      }

      .@{ant-prefix}-card-meta-title {
        font-size: 16px;
      }

      .@{ant-prefix}-card-meta-detail {
        > div:not(:last-child) {
          margin-bottom: 8px;
        }
      }

      .@{ant-prefix}-card-meta-description {
        color: #5a5a5a;
        font-size: 12px;
        height: 28px;
      }

      .@{ant-prefix}-card-actions {
        background-color: #f7f8fa;
        border-top: 0;

        > li {
          margin: 13px 0;

          &:not(:last-child) {
            border-color: #e5e6eb;
          }
        }
      }
    }
  }
}

@bg-color: #f4f7fb;

.configEdit {
  > span {
    display: inline-block;
    padding: 0 4px;
  }
}

.curTree {
  height: calc(100% - 75px);
  padding: 12px 0;
  overflow: auto;

  ul,
  li {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  li {
    padding: 0 10px;
    line-height: 38px;
    border-radius: 10px;
    cursor: default;

    .btn {
      display: none;
      padding: 0 4px;
      color: #999;
      cursor: pointer;

      &:hover {
        color: #666;
      }
    }

    &.active,
    &:hover {
      color: @primary-color;
      background-color: #e6ecff;

      .btn {
        display: inline-block;
      }
    }

    > ul {
      display: none;
      margin-left: 12px;
    }

    &.open {
      > ul {
        display: block;
      }
    }
  }

  .icon {
    margin-right: 8px;
    font-size: 12px;
  }

  .treeNode {
    padding: 4px 2px 4px 6px;
    cursor: pointer;
    user-select: none;

    &:hover {
      background-color: #edecff;
    }
  }
}

.searchDefaultInput {
  padding-left: 20px;
  background: #fafafa;
  border: none;
}

.detailPage {
  .title {
    :global {
      .@{ant-prefix}-typography {
        margin-bottom: 0;
        line-height: 38px;
      }
    }
  }

  width: 100%;
  height: 100%;
  background-color: @bg-color;

  .content {
    display: flex;
    height: calc(100% - 64px);
    margin-top: 64px;
    padding: 24px;

    .search {
      border-bottom: 1px solid #f5f5f5;

      .btn {
        color: #999;
        cursor: pointer;

        &:hover {
          color: #666;
        }
      }
    }

    .dataBase {
      height: 100%;
      padding: 25px 30px 25px 20px;

      .dataBaseTop {
        line-height: 30px;

        .title {
          color: #333;
          font-weight: bold;
          font-size: 17px;
        }

        .refresh {
          color: #1245fa;
        }
      }

      .search {
        margin-top: 16px;
      }
      .curTree {
        li {
          margin-right: 10px;
          padding-left: 20px;
        }
        li:hover {
          color: inherit;
          background: #f4f7fb;
        }
      }
    }

    .datasetInfo {
      height: 100%;

      .infoInner {
        height: calc(100% - 64px);
        padding: 10px 20px;
        overflow-y: auto;

        p {
          color: #666;

          &.title {
            margin-bottom: 8px;
            color: #595959;
            font-weight: bold;
          }
        }
      }
    }

    .dataset {
      height: 100%;

      .datasetInner {
        height: calc(100% - 56px);
        padding: 12px 20px 0;
      }
    }

    .bgInner {
      height: 100%;
      background: #fff;
      border-radius: 20px;

      &.preview {
        .top {
          height: calc(100% - 260px);
        }

        .bottom {
          height: 260px;
        }
      }
    }

    .top {
      height: 60%;
      border-bottom: 4px solid @bg-color;
    }

    .bottom {
      height: 40%;
    }

    .left {
      width: 316px;
      height: 100%;

      .bgInner {
        .header {
          padding: 20px 20px 10px;

          .title {
            margin-bottom: 0;
            font-weight: bold;
            font-size: 16px;
          }
        }
      }
    }

    .right {
      flex: auto;
      width: calc(100% - 320px);
      height: 100%;
      margin-left: 4px;
      .top {
        height: 50%;
      }

      .bottom {
        height: 50%;
      }
    }

    .fieldList {
      height: 100%;
      padding: 20px;

      .listNode {
        height: calc(100% - 50px);
        margin-top: 18px;
      }
    }

    .previewNode {
      height: 100%;
      padding: 22px;

      .previewFooter {
        margin-top: 14px;
        padding-top: 6px;
        line-height: 24px;
        border-top: 1px solid #e9e9e9;

        p {
          margin-bottom: 0;
          color: #999;
          font-size: 12px;
        }
      }

      .previewTable {
        height: calc(100% - 90px);
        overflow-y: auto;
      }

      .previewHeader {
        margin-bottom: 14px;
        padding-bottom: 6px;
        line-height: 24px;
        border-bottom: 1px solid #e9e9e9;

        .btn {
          padding: 0 4px;
          color: #999;
          cursor: pointer;

          &:hover {
            color: #666;
          }
        }

        p {
          margin-bottom: 0;
          font-weight: bold;
        }
      }
    }
  }
}

:global {
  .@{ant-prefix}-checkbox-inner {
    border-spacing: 0;
  }

  .@{pagination-prefix-cls} {
    &-item,
    &-prev,
    &-next,
    &-jump-prev,
    &-jump-next,
    &-total-text {
      height: @pagination-item-size;
      line-height: @pagination-item-size - 2px;
    }

    &-prev,
    &-next,
    &-item,
    &-jump-prev,
    &-jump-next {
      min-width: @pagination-item-size;
    }

    &-options {
      &-quick-jumper {
        height: @pagination-item-size;
        line-height: @pagination-item-size - 2px;

        input {
          height: @pagination-item-size;
        }
      }
    }
  }
}
